function load_parameters(request, response, route) {
  var parameters = {};
  request.setEncoding('UTF8');

  load_post_parameters(request, response, route, parameters);
  load_get_parameters(request, parameters);
}

function load_post_parameters(request, response, route, parameters) {
  var querystring = require('querystring');
  var post_data = '';
  
  request.addListener("data", function(chunk) {
    post_data += chunk;
  });
  
  request.addListener("end", function() {
    var hash = querystring.parse(post_data);
    for (var k in hash) {
      if (hash.hasOwnProperty(k)) {
        parameters[k] = hash[k];
      }
    }
    
    route(request, response, parameters);
  });
}

function load_get_parameters(request, parameters) {
  var querystring = require('querystring');
  var query = require('url').parse(request.url).query;
  var hash = querystring.parse(query);
  
  for (var k in hash) {
    if (hash.hasOwnProperty(k)) {
      parameters[k] = hash[k];
    }
  }
}

exports.load_parameters = load_parameters;
